// JavaScript Document

/*登录面板*/
function toLogin(type){
	switch(type){
		case "show":
			$(".div_mask").css("height",0);
			$("#div_mask_toLogin").css("height",$(window).height()+'px');
		break;
		
		case "submit":
			var email		=	$("#login_email").val();
			var password	=	$("#login_password").val();
	
			if(email == "" || password == ""){
				alert("请将信息填写完全");
			}else{
				$("#form_login").submit();
			}
		break;
		
		case "reset":
			$(".div_mask").css("height",0);
		break;
	}
}

/*注册面板*/
function toSignup(type){
	switch(type){
		case "show":
			$(".div_mask").css("height",0);
			$("#div_mask_tosignup").css("height",$(window).height()+'px');
		break;
		
		case "submit":
			var email		=	$("#signup_email").val();
			var password	=	$("#signup_password").val();
			var password2	=	$("#signup_password2").val();
	
			var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/; 
	
			if(email == "" || password == ""){
				alert("请将信息填写完全");
			}else if(!reg.test(email)){
			alert("邮箱格式不正确,请检查!");
			}else if(password.length<6){
				alert("密码小于六位输,请重新输入!");
			}else if(password != password2){
				alert("两次输入的密码不一致,请检查!");
			}else{
				$("#form_signup").submit();
			}
		break;
		
		case "reset":
			$("#div_mask_tosignup").css("height",0);
		break;
	}
}

/*修改密码*/
function rePassword(type){
	switch(type){
		case "show":
			$(".li_user_ops").animate({height:0,paddingTop:0},200);
			$(".div_mask").css("height",0);
			$("#div_mask_rePwd").css("height",$(window).height()+'px');
		break;
		
		case "submit":
			if($("#form_rePwd [name='rePwd_new_pwd']").val() != $("#form_rePwd [name='rePwd_new_pwd2']").val()){
				alert("两次输入的新密码不一致，请检查!");
			}else if($("#form_rePwd [name='rePwd_old_pwd']").val() == "" || $("#form_rePwd [name='rePwd_new_pwd']").val() == ""){
				alert("请将信息填写完全!");
			}else{
				$("#form_rePwd").submit();
			}
		break;
		
		case "reset":
			$("#div_mask_rePwd").css("height",0);
		break;
	}
}